<?php

abstract class ZFPainel_Controller extends ZFKiller_Controller
{

    public function init()
    {
        parent::init();
        
        /*Zend_Controller_Action_HelperBroker::addPath(
				PATH_ZFEXTEND . '/ZFPainel/Controller/Action/Helper', 'ZFPainel_Controller_Action_Helper'
		);*/
        
        $this->view->addHelperPath(PATH_ZFEXTEND . '/ZFPainel/View/Helper/', 'ZFPainel_View_Helper');

        if ($this->initLayout()) {
            $this->initDoctype();
            $this->initTitle();
        }
    }

    protected function initDoctype()
    {
        $this->view->getHelper('doctype')->setDoctype(Zend_View_Helper_Doctype::HTML5);
    }

    protected function initLayout()
    {
        if ((isset($_GET['ajax'])) && ($_GET['ajax'] == '1')) {
            $this->_helper->layout()->disableLayout();
            return false;
        }
        
        /* if ((!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')) {
          $this->_helper->layout()->disableLayout();
          return false;
          } */

        return true;
    }

    protected function initTitle()
    {
        $this->view->headTitle('Painel ' . SITE_TITLE);
    }

}
